package Text29;

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        long res = 0, sum = 0;
        while (n-- > 0) {
            int w = in.nextInt();
            res += sum * w;
            sum+=w;
        }
        System.out.println(res);
    }
}
